package model

type Floor struct {
	Id         int64  `gorm:"primaryKey;column:id"json:"id" `
	SchoolId   int64  `gorm:"column:school_id;default:0"json:"school_id"`
	JzwId      int64  `gorm:"column:jzw_id;default:0"json:"jzw_id"`
	JzwName    string `gorm:"column:jzw_name;default:''" json:"jzw_name"`
	FloorName  string `gorm:"column:floor_name;default:''" json:"floor_name"`
	Floor      int    `gorm:"column:floor;default:1" json:"floor"`
	CreateTime int64  `gorm:"column:create_time;default:0" json:"create_time" `
}

func (Floor) TableName() string {
	return "fd_floor"
}

type FloorToJzw struct {
	Id         int64  `json:"id" `
	SchoolId   int64  `json:"school_id"`
	JzwId      int64  `json:"jzw_id"`
	JzwName    string `json:"jzw_name"`
	FloorName  string `json:"floor_name"`
	Floor      int    `json:"floor"`
	CreateTime int64  `json:"create_time" `
	//floor.jzw_id = jzw.id
	//references：主表,是FloorToJzw调用的,所以为jzw_id
	//foreignKey：从表,是FloorToJzw调用的,JoinJzw为从表
	Jzw JoinJzw `json:"jzw" gorm:"foreignKey:id;references:jzw_id"`
}

func (f FloorToJzw) TableName() string {
	return "fd_floor"
}

type JoinFloor struct {
	Id        int64  `json:"id" `
	FloorName string `json:"floor_name"`
	Floor     int    `json:"floor"`
}

func (JoinFloor) TableName() string {
	return "fd_floor"
}
